<?php

namespace App\Http\Admin\Controllers\Sms;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;


class SmsManageController extends Controller
{

    public function index()
    {
        return view('sms.sms_list');
    }

    public function listData(Request $request)
    {

        $phone = $request->input('phone') ?? '';
        $page = $request->input('page_size') ?? 20;

        $data = DB::table('admin_sms');
        if (!empty($phone)) {
            $data = $data->where('phonum', $phone);
        }

        $data = $data->orderBy('id', 'desc')->paginate($page);
        return $data;
    }

}